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8BlC,GAYG,CAE7C,GAZF","sources":["webpack://_N_E/?743d","webpack://_N_E/./pages/docfleck/programme/[coursePageId].tsx","webpack://_N_E/./utils/contentful/helpers/getShopifyProductFromTeaser.ts","webpack://_N_E/./utils/trackingEvents/view-item.ts","webpack://_N_E/"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/docfleck/programme/[coursePageId]\",\n function () {\n return require(\"private-next-pages/docfleck/programme/[coursePageId].tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/docfleck/programme/[coursePageId]\"])\n });\n }\n ","import safeStringify from \"fast-safe-stringify\";\n\nimport { GetStaticProps, NextPage } from \"next\";\n\nimport React, { useEffect } from \"react\";\n\nimport { ContentfulNavigation } from \"../../../@types/contentfulNavigation\";\nimport { ICoursePageFields } from \"../../../@types/generated/contentful\";\nimport { ShopifyProductWithVariant } from \"../../../@types/shopifyProductWithVariant\";\nimport CustomContainer from \"../../../components/container\";\nimport ContentSectionWrapper from \"../../../components/content-section-wrapper\";\nimport CountdownBar from \"../../../components/countdown-bar\";\nimport HeroTeaser from \"../../../components/hero-teaser\";\nimport PageLayout from \"../../../components/page/layout\";\nimport getContentfulContentTypeEntries from \"../../../utils/contentful/getContentfulContentTypeEntries\";\nimport getContentfulCoursePage from \"../../../utils/contentful/getContentfulCoursePage\";\nimport { getShopifyProductFromCoursePageTeaser } from \"../../../utils/contentful/helpers/getShopifyProductFromTeaser\";\nimport generateTitle from \"../../../utils/page/generateTitle\";\nimport getJointPageProperties, {\n JointPageProperties,\n} from \"../../../utils/page/getJointPageProperties\";\nimport { DOC_FLECK_TENANT_NAME } from \"../../../utils/tenant-names\";\nimport { isDocFleckTenantPage } from \"../../../utils/tenants\";\nimport pushDataLayerViewItem from \"../../../utils/trackingEvents/view-item\";\n\ninterface CoursePageProps {\n coursePage: ICoursePageFields;\n isPreview?: boolean;\n previewData?: any;\n navigation: ContentfulNavigation;\n jointPageProperties: JointPageProperties;\n}\n\n/**\n * course page\n * @param {CoursePageProps} props\n * @param {ICoursePageFields} props.coursePage\n * @returns JSX.Element\n */\nconst CoursePage: NextPage = ({\n coursePage,\n isPreview,\n previewData,\n navigation,\n jointPageProperties,\n}) => {\n const {\n contentSections,\n heroTeaser,\n seoMetadata,\n countdownCourse,\n noNavigation,\n tenant,\n } = coursePage;\n const {\n fields: { title },\n } = seoMetadata;\n const { footerProps } = jointPageProperties;\n const {\n logoDark,\n logoLight,\n titleSuffix,\n bannerVisible,\n bannerText,\n bannerIcon,\n } = jointPageProperties.siteSettings;\n\n useEffect(() => {\n if (isPreview && previewData?.internal !== \"\") {\n const previewElement = document.getElementById(previewData.internal);\n if (previewElement) {\n previewElement.scrollIntoView({ behavior: \"smooth\" });\n }\n }\n }, [isPreview, previewData.internal]);\n\n const fullTitle = generateTitle(title, titleSuffix);\n let shopifyProduct = getShopifyProductFromCoursePageTeaser(coursePage);\n useEffect(() => {\n addTrackingEvents(shopifyProduct);\n return () => {};\n }, []);\n\n return (\n \n {heroTeaser && (\n \n \n \n )}\n {contentSections?.map((section, i) => (\n \n ))}\n {countdownCourse && (\n \n )}\n \n );\n};\n\nexport default CoursePage;\n\n/**\n * This function gets called at build time to pre-fetch the routes of the course pages\n * @returns {Promise<{paths: {params: {courseId: string}}[], fallback: boolean}>}\n */\nexport const getStaticPaths = async () => {\n // Call contentful API endpoint to get course pages\n const pages = await getContentfulContentTypeEntries({\n contentType: \"coursePage\",\n }).then((entries) => entries.items.map((entry) => entry.fields));\n\n // Filter tenant pages\n const filteredPages = pages.filter((page) => isDocFleckTenantPage(page));\n\n // Get the paths we want to pre-render based on course pages\n const paths = filteredPages.map((page) => ({\n params: { coursePageId: page.slug },\n }));\n\n // We'll pre-render only these paths at build time.\n // { fallback: false } means other routes should 404.\n return { paths, fallback: false };\n};\n\n/**\n * This function gets called at build time on server-side to statically pre-fetch the data for the course page\n * @param {GetStaticPropsContext} context\n * @returns course page data\n */\nexport const getStaticProps: GetStaticProps = async (\n context\n) => {\n const [coursePage, jointPageProperties] = await Promise.all([\n // Get the course page slug from the context\n getContentfulCoursePage({\n coursePageId: context.params?.coursePageId?.toString() || \"\",\n isPreview: context.preview || false,\n previewData: context.previewData,\n }),\n getJointPageProperties(context, DOC_FLECK_TENANT_NAME),\n ]);\n\n // if no course page was found, return 404\n if (!coursePage) {\n return { notFound: true };\n }\n\n const pageProps = safeStringify({\n coursePage: coursePage.fields,\n isPreview: context.preview || false,\n previewData: context.previewData || {\n env: process.env.NEXT_PUBLIC_CONTENTFUL_ENV,\n internal: \"\",\n },\n navigation: jointPageProperties.navigation,\n jointPageProperties,\n theme: DOC_FLECK_TENANT_NAME,\n });\n\n const props = JSON.parse(pageProps);\n // Pass course page data to the page via props\n return {\n props,\n };\n};\n\n/**\n * Writes view_item tracking event.\n * @param shopifyProduct\n */\nfunction addTrackingEvents(shopifyProduct: ShopifyProductWithVariant | null) {\n if (shopifyProduct) {\n pushDataLayerViewItem(shopifyProduct);\n }\n}\n","import {\n ICoursePageFields,\n ITeaserProduct,\n} from \"../../../@types/generated/contentful\";\nimport { ShopifyProductWithVariant } from \"../../../@types/shopifyProductWithVariant\";\nimport { IProductFieldsModified } from \"../../shopify/createCart\";\n\n/**\n *\n * @param coursePage\n * @returns ShopifyProductWithVariant\n */\nexport function getShopifyProductFromCoursePageTeaser(\n coursePage: ICoursePageFields\n) {\n let content;\n\n if (!coursePage.heroTeaser) {\n return null;\n }\n\n content = coursePage.heroTeaser.fields.content;\n\n // get product referenced in hero-teaser\n return (\n (content as unknown as ITeaserProduct).fields.product\n .fields as IProductFieldsModified\n ).shopifyProduct;\n}\n","import { ShopifyProductWithVariant } from \"../../@types/shopifyProductWithVariant\";\nimport { DataLayerItem, clearDataLayer, getDataLayerItem } from \"./common\";\n\ninterface ViewItemEvent {\n event: string;\n ecommerce: {\n currency: string;\n totalValue: number;\n items: DataLayerItem[];\n };\n}\n\nconst EVENT_NAME = \"view_item\";\n\nconst pushDataLayerViewItem = (shopifyProduct: ShopifyProductWithVariant) => {\n if (typeof window !== \"undefined\" && window.dataLayer) {\n clearDataLayer();\n window.dataLayer.push(getDataLayerEvent(shopifyProduct));\n }\n};\n\nfunction getDataLayerEvent(\n shopifyProduct: ShopifyProductWithVariant\n): ViewItemEvent {\n return {\n event: EVENT_NAME,\n ecommerce: {\n currency: shopifyProduct?.minPrice.currencyCode,\n totalValue: shopifyProduct?.price.amount,\n items: [getDataLayerItem(shopifyProduct)],\n },\n };\n}\n\nexport default pushDataLayerViewItem;\n"],"names":["window","__NEXT_P","push","__webpack_require__","__webpack_exports__","coursePage","isPreview","previewData","navigation","jointPageProperties","param","contentSections","heroTeaser","seoMetadata","countdownCourse","noNavigation","tenant","fields","title","footerProps","logoDark","logoLight","titleSuffix","bannerVisible","bannerText","bannerIcon","siteSettings","useEffect","internal","previewElement","document","getElementById","scrollIntoView","behavior","fullTitle","generateTitle","shopifyProduct","getShopifyProductFromCoursePageTeaser","pushDataLayerViewItem","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsxs","PageLayout","footer","logoHeader","logoFooter","metadata","jsx","CustomContainer","backgroundColor","HeroTeaser","map","section","i","ContentSectionWrapper","concat","CountdownBar","content","product","Z","dataLayer","clearDataLayer","event","ecommerce","currency","minPrice","currencyCode","totalValue","price","amount","items","getDataLayerItem"],"sourceRoot":""}